#include<bits/stdc++.h>
using namespace std;

const int MAXN = 1010;
char a[MAXN][MAXN]; // map
int vis[MAXN][MAXN] = {0};
int d[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
int flag;
void dfs(int x, int y) {
    vis[x][y] = 1;
    if (a[x][y + 1] == '#' && a[x][y - 1] == '#' && a[x - 1][y] == '#' && a[x + 1][y] == '#') flag = 1;
    for (int i = 0; i < 4; i++) {
        int x1 = x + d[i][0], y1 = y + d[i][1];
        if (vis[x1][y1] == 0 && a[x1][y1] == '#') dfs(x1, y1);
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            cin >> a[i][j];
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (a[i][j] == '#' && vis[i][j] == 0) {
                flag = 0;
                dfs(i, j);
                if (flag == 0) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}